package pe.edu.unmsm.fisi.sysllabus.integracion.dao.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Repository;

import com.ibatis.sqlmap.client.SqlMapClient;

import pe.edu.unmsm.fisi.sysllabus.integracion.dao.PlanEstudioDAO;
import pe.edu.unmsm.fisi.sysllabus.negocio.modelo.dto.PlanEstudioDTO;

@Repository
public class PlanEstudioDAOImpl extends SqlMapClientDaoSupport implements PlanEstudioDAO {

	@Autowired
	public PlanEstudioDAOImpl(SqlMapClient sql) {
		super.setSqlMapClient(sql);
	}

	@Override
	public List<PlanEstudioDTO> listPlanesEstudioPorCarrera(
			Integer idCarreraProf) throws DataAccessException {
		return (List<PlanEstudioDTO>)getSqlMapClientTemplate().queryForList("PlanEstudio.listPlanesEstudioPorCarrera", idCarreraProf);
	}

	@Override
	public void insertPlanEstudio(PlanEstudioDTO plan)
			throws DataAccessException {
		getSqlMapClientTemplate().insert("PlanEstudio.insertPlanEstudio", plan);
		
	}

	@Override
	public void updatePlanEstudio(PlanEstudioDTO plan)
			throws DataAccessException {
		getSqlMapClientTemplate().update("PlanEstudio.updatePlanEstudio", plan);
		
	}

	@Override
	public PlanEstudioDTO getPlanEstudio(Integer idPlanEstudio)
			throws DataAccessException {
		return (PlanEstudioDTO)getSqlMapClientTemplate().queryForObject("PlanEstudio.getPlanEstudio", idPlanEstudio);
	}

	@Override
	public PlanEstudioDTO getplanEstudioxIdCurso(Integer idCurso) {
		return (PlanEstudioDTO)getSqlMapClientTemplate().queryForObject("PlanEstudio.getPlanEstudioxIdCurso", idCurso);
	}

}
